home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / mathstud.zip / AUTOASGN.M < prev    next >
Text File  |  1994-01-23  |  2KB  |  86 lines

  1. %Demonstartion of MAthViews' AutoAssign technology.
  2. %By changing x and/or n the affected graphics windows updates
  3. %automatically, by the invocation of the appropriate M-file
  4.  
  5. %       S.Halevy 7/31/92
  6. %       Copyright (c) 1992 by the MathWizards
  7.  
  8. % Let us define the graphics windows for this demo
  9.  
  10. clear
  11. % Graphics Windows Placement (8 graphics windows)
  12. _xw=[0.59   0   0.2 0.25
  13.     0.79   0        0.2 0.25
  14.     0.59   0.25   0.2 0.25
  15.     0.79   0.25   0.2 0.25
  16.     0.59   0.5     0.2 0.25
  17.     0.79   0.5     0.2 0.25
  18.     0.59   0.75   0.2 0.25
  19.     0.79   0.75   0.2 0.25];
  20.  
  21. %Graphics Windows Titles
  22. _xt=['G1'
  23.      'G2'
  24.      'G3'
  25.      'G4'
  26.      'G5'
  27.      'G6'
  28.      'G7'
  29.      'G8'];
  30.  
  31. %define palette colors (RGB values)
  32. _pl=[127   0 127
  33.        0   0   0          % black
  34.      255   0   0          % red
  35.        0 255   0          % green
  36.        0   0 255          % blue
  37.        0 255 255          % light blue
  38.      255   0 255          % magenta
  39.      255 255   0          % yellow
  40.      127 127 127          % dark gray
  41.      127   0   0          % dark red
  42.        0 127   0          % dark green
  43.        0   0 127          % dark blue
  44.        0 127 127          % dark indigo
  45.      127   0 127          % purple
  46.      127 127   0          % dark yellow
  47.      192 192 192          % light gray
  48.       64 127   0
  49.      127  64   0
  50.      127   0  64
  51.      127  64  64
  52.       64   0  64
  53.       64  64 127
  54.      127 255   0
  55.      255 127 255
  56.        0 255 127
  57.      255   0 127
  58.      255 127 127];
  59.  
  60. gwinit(_xw,_xt,_pl);   % initialize Graphic Windows
  61.  
  62.  
  63. % Now the input arguments
  64.  
  65. x=1:32    % input argument
  66. n=1       % input argument
  67.  
  68. % autoplot is an M-file which generates x-y plot in a specified
  69. % graphics window. Autoplot forth parameter is the window title.
  70.  
  71. y1:=autoplt(x,x.^2,1,'x.^2');
  72. y2:=autoplt(x,abs(fft(x)),2,'abs(fft(x))');
  73. y3:=autoplt(x,sin(6*n*x/max(x)),3,'sin(x)');
  74.  
  75. % automesh is an M-file which generates a mesh plot in a specified
  76. % graphics window. Autoplot third parameter is the window title.
  77.  
  78. y4:=automsh(x'*x,4,'sin(x)');
  79.  
  80. disp('now change x and n in the interactive and watch how the related');
  81. disp('plots update automatically');
  82. disp('NOTE: x should be a vector and n a scalar');
  83. disp('');
  84. disp('You may clear the relations with the clear command');
  85. disp('For single graphics window use gwinit(1)');
  86.